const Router = require('koa-router');


const router = Router();

const auth = require('../middleware/auth')


const Article = require('../controllers/article.controller')



router
  .post('/insert', auth(), Article.addArticle)//添加文章

  .get('/article', auth({required: false}),Article.currentArticle)//获取当前文章
  .get('/user',auth({required: false}),Article.userAticle)//获取用户全部文章
  .get('/user/favorite',auth(),Article.favoreteArticle)//获取用户收藏的文章
  .get('/all',auth({required: false}),Article.allArticle)//获取全部文章

  .post('/favorite',auth(),Article.addFavorite)//收藏文章
  .post('/update',auth(),Article.updateArticle)//更新文章
  .post('/delete',auth(),Article.deleteArticle)//删除文章

module.exports = router